return "TURN TOWARDS MOUSE" & RETURN & RETURN & "Orients a sprite to face (or turn away from) the mouse pointer, even if the sprite is moving." & RETURN & RETURN & "You can choose whether the sprite always turns to face the mouse, or only when the mouse button is up or down. " & "When the mouse is in the other state, the will either return to its initial position, or remain in the position it was in when the mouse state changed." & RETURN & RETURN & "The graphic member is considered to face right when it is at rest." & RETURN & RETURN & "PERMITTED MEMBER TYPES:" & RETURN & "bitmap, Flash, vector shape" & RETURN & RETURN & "PARAMETERS:" & RETURN & "* Whether to turn toward or away from the mouse" & RETURN & "* When to turn (always, while mouse is up, or while mouse is down)" & RETURN & "* Whether to return to initial position or remain in new position"
end
on getBehaviorTooltip me
return "Use with bitmap, Flash and vector shape members." & RETURN & RETURN & "Orients a sprite to face towards or away from the mouse pointer, even if the sprite is moving." & RETURN & RETURN & "You can make the sprite face the mouse at all times, or only when the mouse is up or down. " & "When the mouse is in the other state, the sprite can either revert to its original postion, or remain in the position it was in when the mouse state changed. " & "The member is considered to face right at rest."
end
on beginSprite me
Initialize(me)
end
on prepareFrame me
if Activate(me) then
Turn(me)
else
if myResetFlag then
if mySprite.rotation <> myInitialAngle then
mySprite.rotation = myInitialAngle
end if
end if
end if
end
on Initialize me
mySprite = sprite(me.spriteNum)
memberType = mySprite.member.type
case memberType of
#flash, #vectorShape:
mySprite.scaleMode = #autoSize
end case
myMouseDown = the stillDown
myInitialAngle = mySprite.rotation
myOrientation = myOrientation = "away from the mouse"
case myActivePeriod of
"always":
myActivePeriod = #always
"when the mouse is clicked":
myActivePeriod = #mouseClick
"when the mouse is released":
myActivePeriod = #mouseRelease
"while the mouse is down":
myActivePeriod = #mouseDown
"while the mouse is up":
myActivePeriod = #mouseUp
end case
myResetFlag = myResetFlag = "return to the initial position"
return [#myOrientation: [#comment: "Turn", #format: #string, #range: ["towards the mouse", "away from the mouse"], #default: "towards the mouse"], #myActivePeriod: [#comment: EMPTY, #format: #string, #range: ["while the mouse is down", "while the mouse is up", "when the mouse is clicked", "when the mouse is released", "always"], #default: "while the mouse is down"], #myResetFlag: [#comment: "Otherwise", #format: #string, #range: ["return to the initial position", "remain in the new position"], #default: "return to the initial position"]]